package com.scs.application.modules.base.controller;

import com.scs.application.core.mvc.controller.CrudController;
import com.scs.application.modules.base.dto.SettingSafeStockDTO;
import com.scs.application.modules.base.entity.SafeStock;
import com.scs.application.modules.base.service.SafeStockService;
import com.scs.application.modules.sys.model.RestResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 安全库存 前端控制器
 * </p>
 */
@RestController
@RequestMapping("/base/safe_stock")
public class SafeStockController extends CrudController<SafeStockService, SafeStock> {

    /**
     * 设置安全库存
     * @param dto
     * @return
     */
    @PostMapping("/settingSafeStock")
    public RestResult settingSafeLocation(@RequestBody @Valid SettingSafeStockDTO dto) {
        service.settingSafeLocation(dto.getLocationId(),dto.getMatrIdList());
        return RestResult.ok();
    }


}
